package com.bw.zcb.network.tool;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.bw.zcb.R;

public class Glide01 {
    public static void loadMatchImg(String url, ImageView img){
        Glide.with(img.getContext()).load(Api.FileUrl+url)
                .placeholder(R.drawable.exo_styled_controls_next)
                .error(R.drawable.chose_image_back)
                .centerCrop()
                .into(img);
    }
    public static void loadCircleImg(String url, ImageView img){
        Glide.with(img.getContext())
                .load(Api.FileUrl+url)
                .error(R.drawable.ic_launcher_background)
                .apply(RequestOptions.bitmapTransform(new CircleCrop()))
                .into(img);
    }

    public static void loadRoundImg(String url, ImageView img,int radius){
        Glide.with(img.getContext())
                .load(Api.FileUrl+url)
                // 圆角效果
                .transform(new RoundedCorners(5))
                .into(img);
    }

}
